const env = (key: string, defaultValue = null) => {
    return process.env[key] !== undefined ? process.env[key] : defaultValue;
}


const json = (data, status = 200, message = '成功', debug = false, error = null) => {
    return {
        status,
        data,
        message,
        debug,
        error
    };
}
 
function is<T>(obj: T): boolean {
    try {
        let o: T = obj;
        console.log(o);
        return o ? true : false;
    }catch(error){
        return false;
    }
}

export {env, json, is};